<?php

class Index_IndexController extends Lin_Template
{
	private $user;
	public function __construct()
	{
		$this->user = new Model_User_User();
	}

	public function indexAction()
	{
		
		if (isset($_POST['action']) && $_POST['action'] == 'login')
		{
			$account = $_POST['account'];
			$password = $_POST['password'];
			$dt = $this->user->getAll("`user_account` = '{$account}'", array('user_account', 'user_pwd'), 'user_account');
			$status = false;
			if ($dt && count($dt) > 0)
			{
				if ($dt[$account]['user_pwd'] ==  md5($password))
				{
					$status = true;
					$_SESSION['user'] = $dt[$account];
				}
			}
			if ($status)
				//echo '<script>location.replace("/index/index/plat/");</script>';
				header('Location:/index/index/plat');
			else
				Lin_Dialog::msg('Login', 'Logon failture!', '/');
		}
	}
	
	public function _logoutAction()
	{
		session_destroy();
		Lin_Dialog::msg('Logout', 'Logout success !','/');
	}
	
	public function platAction()
	{
		
	}
	
	public function menuAction()
	{
		
	}
	
	public function topAction()
	{
		
	}
	
	public function midAction()
	{
		
	}
	
	public function mainAction()
	{
		
	}
	
	
	
}